# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>

_realname=libview
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.6.6
pkgrel=4
arch=('any')
pkgdesc="VMware's Incredibly Exciting Widgets (mingw-w64)"
options=(strip staticlibs)
depends=("${MINGW_PACKAGE_PREFIX}-gtk2"
         "${MINGW_PACKAGE_PREFIX}-gtkmm")
options=('strip' 'staticlibs')
license=("GPL 2")
url="https://view.sourceforge.io/"
source=(https://downloads.sourceforge.net/view/${_realname}-${pkgver}.tar.bz2
        001-win.patch
        002-missing-execprefix.patch)
sha256sums=('2b991bf150c5488b43f807e89bdbd64b2eb3bd433abbdfb68c3eec52cbaa59ab'
            '7e7506735bf4c86c52aee2066955f18d539496cee9a41ed126cdb98b19bff24e'
            '20ff38d461360fe3062f70d27f2d9f9b0e3d3db6de3042e9893a0660ab6cab4a')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}

  patch -p1 -i ${srcdir}/001-win.patch
  patch -p1 -i ${srcdir}/002-missing-execprefix.patch

  autoreconf -isf
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST}

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}
